<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <h5>{{ this.$store.getters.getAllName }}</h5>
    <h5>{{ this.getAllName }}</h5>
    <h3>{{ this.$store.state.city_name }}</h3>
    <h4>{{ this.$store.state.area_name }}</h4>
    <h3>{{ this.city_name }}</h3>
    <h3>{{ this.area_name }}</h3>
    <h4>{{ this.$store.state.moduleA.text }}</h4>
    <h4>{{ this.$store.state.moduleB.text }}</h4>
    <h5>{{ this.nameText }}</h5>
  </div>
</template>

<script>
import { mapState, mapGetters } from "vuex";
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: '学习如何使用Vuex'
    }
  },
  computed: {
    ...mapState(['city_name','area_name']),
    ...mapGetters(['getAllName']),
    ...mapState({
      nameText: state => state.moduleA.text,
    }),
  },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
